{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "introductory-custody",
   "metadata": {},
   "source": [
    "# Extending Bifrost\n",
    "\n",
    "With the overview of Bifrost and how to build pipelines within the framework out of the way we can turn our attention to extending the core functionality of Bifrost.  There are currently three options:\n",
    " 1. A pure Python implementation within the low or high level APIs,\n",
    " 2. Using just-in-time compilation via numba or bifrost.map for the implemenations, or\n",
    " 3. Adding a new C/C++/CUDA module, along with the associated Python wrapper, to Bifrost.\n",
    "\n",
    "The first two options are straight forward and have been demonstrated earlier in this tutorial.  The third option is more involved and this section provides a brief \"how to\".\n",
    "\n",
    " 1. Create a new source file in `src/` that defines that functions or classes you want.  In general these functions should take in C/C++ pointers to `BFarray`s and return `BFstatus` code (see `src/bifrost/common.h`).\n",
    " 2. Create a C-compatible header file for your functions in `src/bifrost/`.  This will be used to create the Python wrappers via `ctypesgen` that will go into `bifrost.libbifrost_generated`.\n",
    " 3. Update `src/Makefile` and add the object file associated with the new source files to `LIBBIFROST_OBJS` so that they get built with `make`.\n",
    " 4. Build the necessary low level Python API wrappers needed in `python/bifrost/`.\n",
    " 5. Optionally, build the necessary high level Python API wrapper needed in `python/bifrost/blocks/`.\n",
    " \n",
    "We are also working on a plugin system for Bifrost that should make this process easier by eliminating steps 3 and 4.  To get a preview of this system see: https://github.com/lwa-project/bifrost/tree/plugin-wrapper/plugins"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "great-mercury",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
